import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EnergyConsumptionVO, EnergyConsumptionForm, EnergyConsumptionQuery } from '@/api/system/energyConsumption/types';

/**
 * 查询看板能耗监控列表
 * @param query
 * @returns {*}
 */

export const listEnergyConsumption = (query?: EnergyConsumptionQuery): AxiosPromise<EnergyConsumptionVO[]> => {
  return request({
    url: '/system/energyConsumption/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询看板能耗监控详细
 * @param id
 */
export const getEnergyConsumption = (id: string | number): AxiosPromise<EnergyConsumptionVO> => {
  return request({
    url: '/system/energyConsumption/' + id,
    method: 'get'
  });
};

/**
 * 新增看板能耗监控
 * @param data
 */
export const addEnergyConsumption = (data: EnergyConsumptionForm) => {
  return request({
    url: '/system/energyConsumption',
    method: 'post',
    data: data
  });
};

/**
 * 修改看板能耗监控
 * @param data
 */
export const updateEnergyConsumption = (data: EnergyConsumptionForm) => {
  return request({
    url: '/system/energyConsumption',
    method: 'put',
    data: data
  });
};

/**
 * 删除看板能耗监控
 * @param id
 */
export const delEnergyConsumption = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/energyConsumption/' + id,
    method: 'delete'
  });
};
